package com.tfswx.fljdmxyy.query.rzgl;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 异常日志查询参数
 *
 * @Author 陈文佳
 * @Date 2023/03/24
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class YcrzQueryParam implements Serializable {

    @ApiModelProperty(name = "czrdwbm", value = "操作人单位编码")
    private List<String> czrdwbm;

    @ApiModelProperty(name = "cwKssj", value = "错误开始时间")
    private Date cwKssj;

    @ApiModelProperty(name = "cwJssj", value = "错误结束时间")
    private Date cwJssj;

    @ApiModelProperty(name = "gjz", value = "关键字")
    private String gjz;

    public void setCwKssj(Date cwKssj) {
        if (ObjectUtil.isNotEmpty(cwKssj)) {
            this.cwKssj = DateUtil.beginOfDay(cwKssj);
        }
    }

    public void setCwJssj(Date cwJssj) {
        if (ObjectUtil.isNotEmpty(cwJssj)) {
            this.cwJssj = DateUtil.beginOfDay(DateUtil.offsetDay(cwJssj, 1));
        }
    }
}